<template>
    <basic-container >
			<dataList
				placeholder="请输入考核模板名称"
				:pageInfo="pager"
				:listData="tableData"
				searchName="name"
				:menuList="['add']"
				@menu-click="handleMenuClick"
			>
				<el-table :data="tableData" align="center">
					<el-table-column label="考核模板名称" prop="name"></el-table-column>
					<el-table-column label="备注" prop="remarks"></el-table-column>
					<el-table-column label="最后更新时间" prop="operateTime"></el-table-column>
					<el-table-column label="操作">
						<template slot-scope="scope">
							<el-button type="text" @click="edit(scope.row.assessTemplateId)">编辑</el-button>
							<span class="btn-line"></span>
							<el-button type="text" @click="del(scope.row.assessTemplateId)">删除</el-button>
						</template>
					</el-table-column>
				</el-table>
			</dataList>
        <el-dialog
            :title="isEdit?'编辑考核模板':'新增考核模板'"
            :visible.sync="dialogVisible"
            width="85%"
            :before-close="handleClose"
             :close-on-click-modal="false">

            <div class="card-title">基本信息</div>
            <el-row>
                <el-form class="form-wrap" :model="formData" size="small" ref="formData" :rules="rules">
                    <el-form-item label="考核名称:"  prop="name">
                        <span><el-input v-model="formData.name"  maxlength="32"  placeholder="请输入考核名称"></el-input></span>
                    </el-form-item>
                    <el-form-item label="备注:">
                        <span><el-input v-model="formData.remarks" maxlength="255" placeholder="请输入备注"></el-input></span>
                    </el-form-item>
                </el-form>
            </el-row>

            <br>
            <div class="card-title">考核项明细</div>
            <el-row>
                <el-col :span="24" align="right">
                    <el-button type="primary" @click="addDetail()">添加考核项</el-button>
                </el-col>
            </el-row>
            <el-form :model="rules_formDataDetail" :rules="rules_formDataDetail.rules" ref="rules_formDataDetail">
                <el-table :data="rules_formDataDetail.formDataDetail"
                            stripe
                          align="center"
                          style="width: 100%">
                    <el-table-column
                        type="index"
                        label="序号"
                        width="50">
                    </el-table-column>
                    <el-table-column
                        prop="item"
                        align="center"
                        width="200px"
                        label="考核项"
                       >
                        <template slot-scope="scope">
                            <el-form-item
                                :prop="'formDataDetail.' + scope.$index + '.item'"
                                :rules="rules_formDataDetail.rules.item"
                            >
                                <el-input  maxlength ="255" v-model="scope.row.item"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column
                        prop="weightValue"
                        align="center"
                        width="200px"
                        label="权重%">
                        <template slot-scope="scope">
                            <el-form-item
                                :prop="'formDataDetail.' + scope.$index + '.weightValue'"
                                :rules="rules_formDataDetail.rules.weightValue"
                            >
                                <el-input-number v-model.number="scope.row.weightValue" :min="0" :max="100"></el-input-number>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column
                        prop="remarks"
                        align="center"
                        width="500px"
                        label="评分说明"
                       >
                        <template slot-scope="scope">
                            <el-form-item
                                :prop="'formDataDetail.' + scope.$index + '.remarks'"
                                :rules="rules_formDataDetail.rules.remarks"
                            >
                                <el-input  maxlength ="255" v-model="scope.row.remarks"></el-input>
                            </el-form-item>
                        </template>
                    </el-table-column>
                    <el-table-column width="100" label="操作" align="center">
                        <template slot-scope="scope">
                            <el-link @click.stop="deleteDetail(scope.$index)">删除</el-link>
                        </template>
                    </el-table-column>
                </el-table>
            </el-form>
            <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="save">保 存</el-button>
  </span>
        </el-dialog>
    </basic-container>
</template>
<script src="./list.js"></script>

<style scoped lang="scss">
    @include formWrap();
    /deep/ .el-message-box {
        z-index:5000!important;
    }
</style>
